package websocket

import (
	"encoding/json"
	"server/pkg/log"
)

type Message struct {
	Type string      `json:"type"`
	Data interface{} `json:"data"`
}

func (m *Message) ToByte() []byte {
	v, e := json.Marshal(m)
	if e != nil {
		log.Debug("Message", e.Error())
		return []byte("")
	}
	return v
}
